using System;
using System.Data;
using System.Collections.Generic;
using System.Data.SqlClient;
using Core;

namespace DataAccess
{
    public class tbGroupUser : Popular
    {


        public int Group_UserID { get; set; }
        public int GroupId { get; set; }
        public int UserID { get; set; }
        Common<tbGroupUser> cm = new Common<tbGroupUser>();
        public bool Insert(Popular b)
        {
            return cm.Insert(b as tbGroupUser, "sp_tbGroupUser_Insert");
        }
        public bool Update(Popular b)
        {
            return cm.UpDate(b as tbGroupUser, "sp_tbGroupUser_Update");
        }
        public bool Delete(object b)
        {
            return cm.Delete(b, "sp_tbGroupUser_Delete");
        }
        public IDataReader Select_ID(object b)
        {
            return cm.Select_ID(b, "sp_tbGroupUser_SelectByID");
        }
        public IDataReader Select_Name(object b)
        {
            return cm.Select_Name(b, "sp_tbGroupUser_SelectByName");
        }
        public IDataReader SelectAll()
        {
            return cm.Select_All("sp_tbGroupUser_SelectAll");
        }
        public List<tbGroupUser> SelectAllToList()
        {
            return cm.SelectAll<tbGroupUser>("sp_tbGroupUser_SelectAll");
        }

        public List<tbGroupUser> GetByUser(int userid)
        {
            return CBO.FillCollection<tbGroupUser>(DataProvider.Instance.ExecuteReader("sp_tbGroupUser_GetByUser", userid));
        }
    }
}